#ifndef CPP_DRAWABLE_H
#define CPP_DRAWABLE_H

#include <Rect.h>
class Canvas;

//@brief 画布
//@author cvte
//@description 可绘制的对象的抽象，例如矩形，图片等,通常用来处理资源文件描述的可绘制对象
class Drawable {
   public:
    const static Rect ZERO_BOUNDS_RECT;
    Drawable();
    virtual ~Drawable();

    virtual void draw(Canvas& canvas);
    virtual void setAlpha(int alpha);

    void setLayoutDirection(int direction);
    int getLayoutDirection();

    int* getState();
    bool setState(int state[]);

    void setLevel(int level);
    int getLevel();

    bool isVisible();

    void jumpToCurrentState();

    Drawable& getCurrent();

    //@method setBounds
    //@param left 左边
    //@param top 顶部
    //@param right 右边
    //@param bottom 底部
    //@description 为可绘制对象设定一个边界矩形
    void setBounds(int left, int top, int right, int bottom);
    //@method setBounds
    //@param bounds 矩形边界
    //@description 为可绘制对象设定一个边界矩形
    void setBounds(Rect& bounds);

   private:
    int mStateSet[1] = {0};
    int mLevel = 0;
    Rect mBounds = ZERO_BOUNDS_RECT;
    bool mVisible = true;
    int mLayoutDirection = 0;
};

#endif /* CPP_DRAWABLE_H */